package com.shandao.shangxiu.util;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.shandao.shangxiu.ui.LoginActivity;
import com.shandao.shangxiu.ui.MainActivity;
import com.shandao.shangxiu.ui.MyWebViewActivity;


/**
 * Created by king on 2015/10/21.
 */
public class UIHelper {


	

    /**
     * 打开浏览器
     * 
     * @param context
     * @param url
     */
    public static void openBrowser(Context context, String url,String title) {
    	 if (url == null)
             return;
//        try {
//              //启用外部浏览器
//             Uri uri = Uri.parse(url);
//             Intent it = new Intent(Intent.ACTION_VIEW, uri);
//             context.startActivity(it);
////            Bundle bundle = new Bundle();
////            bundle.putString(BrowserFragment.BROWSER_KEY, url);
//        } catch (Exception e) {
//            e.printStackTrace();
//            ToastUtils.show("无法浏览此网页");
//        }
        Intent intent = new Intent(context, MyWebViewActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("url", url);
        bundle.putString("title", title);
		intent.putExtras(bundle);
		context.startActivity(intent);
    }
	/**
	 * 显示登录页面
	 * 
	 * @param activity
	 */
	public static void showLoginActivity(Activity activity) {
		Intent intent = new Intent(activity, LoginActivity.class);
		activity.startActivity(intent);
	}


	public static void showRegistActivity(Activity activity) {
	}

	public static void showForgetActivity(Activity activity) {
	}

	public static void showMainActivity(Activity activity) {
		Intent intent = new Intent(activity, MainActivity.class);
		activity.startActivity(intent);
	}
}
